<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        window.addEventListener('DOMContentLoaded', function() {
            setTimeout(function() {
                console.log('爆炸了');
            }, 2000)

            function callback() {
                console.log('时间到了');

            }
            var time1 = setTimeout(callback, 2000);
            var time2 = setTimeout(callback, 3000);
            var btn = document.querySelector('button');
            btn.addEventListener('click', function() {
                clearTimeout(time2);
            })
            var time3 = setInterval(callback, 1000)
        })
    </script>
    <button>点击停止</button>
</body>

</html>